home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / program / smixw130.zip / SMIX.H < prev    next >
C/C++ Source or Header  |  1997-06-06  |  6KB  |  123 lines

  1. /*      SMIXW is Copyright 1995 by Ethan Brodsky.  All rights reserved      */
  2.  
  3. /* ██ SMIX.H ██████████████████████████████████████████████████████████████ */
  4.  
  5. #define TRUE  1
  6. #define FALSE 0
  7.  
  8. #define ON  1
  9. #define OFF 0
  10.  
  11. typedef struct
  12.   {
  13.     signed   char *soundptr;
  14.     unsigned long soundsize;
  15.   } SOUND;
  16.  
  17. int  init_sb(int baseio, int irq, int dma, int dma16);
  18.   /* Initializes control parameters, resets DSP and installs int. handler   */
  19.   /*  Parameters:                                                           */
  20.   /*   baseio    Sound card base IO address                                 */
  21.   /*   irq       Sound card IRQ setting                                     */
  22.   /*   dma       Sound card 8-bit DMA channel                               */
  23.   /*   dma16     Sound card 16-bit DMA channel                              */
  24.   /*  Returns:                                                              */
  25.   /*   TRUE      Sound card successfully initialized                        */
  26.   /*   FALSE     Sound card could not be initialized                        */
  27.  
  28. void shutdown_sb(void);
  29.   /* Removes interrupt handler and resets DSP                               */
  30.  
  31.  
  32. void set_sampling_rate(unsigned short rate);
  33.   /* Overrides default sampling rate set with SAMPLING_RATE constant        */
  34.   /*  Parameters:                                                           */
  35.   /*   Rate:     New sampling rate (will be rounded by sound card)          */
  36.   /* This function can either be called before calling InitMixing (after    */
  37.   /* calling InitSB) to change the sampling rate before playback begins or  */
  38.   /* called during playback to change the rate dynamically.  The lowest     */
  39.   /* sampling rate that will work is roughly 5000 HZ.  The highest sampling */
  40.   /* rate that will work on all sound cards is 22050 HZ.  If you only want  */
  41.   /* to support the SB16, then you can use rates all the way up to 48000 HZ */
  42.  
  43.  
  44. void init_mixing(void);
  45.   /* Allocates internal buffers and starts digitized sound output           */
  46.  
  47. void shutdown_mixing(void);
  48.   /* Deallocates internal buffers and stops digitized sound output          */
  49.  
  50.  
  51. int open_sound_resource_file(char *filename);
  52.   /* Opens a resource file for loading sounds.  After this has been called, */
  53.   /* the Key parameter in the LoadSound function is used as a resource key  */
  54.   /* to locate the sound data in this file.                                 */
  55.   /*  Parameters:                                                           */
  56.   /*   FileName: File name of resource file                                 */
  57.   /*  Returns:                                                              */
  58.   /*   TRUE      Sound resource file exists                                 */
  59.   /*   FALSE     Error, sound resource file does not exist                  */
  60.  
  61. void close_sound_resource_file(void);
  62.   /* Close sound resource file.  If you have called this, the Key parameter */
  63.   /* to the LoadSound function will act as a filename instead of a resource */
  64.   /* key.                                                                   */
  65.  
  66.  
  67. int load_sound(SOUND **sound, char *key);
  68.   /* Allocates an memory buffer and loads a sound from a file               */
  69.   /*  Parameters:                                                           */
  70.   /*   sound     Pointer to pointer to unallocated sound data structure     */
  71.   /*   key       If a resource file has been opened then key is a resource  */
  72.   /*             identifier.  Use the same ID as you used when adding the   */
  73.   /*             sound resource with SNDLIB.  If a resource file is not     */
  74.   /*             opened, then key is the filename from which to load the    */
  75.   /*             sound data.                                                */
  76.   /*  Returns:                                                              */
  77.   /*   TRUE      Sound loaded successfully                                  */
  78.   /*   FALSE     Error loading sound                                        */
  79.  
  80. void free_sound(SOUND **sound);
  81.   /* Frees sound data structure and extended memory block                   */
  82.   /*  Parameters:                                                           */
  83.   /*   sound     Pointer to pointer to allocated sound data structure       */
  84.  
  85.  
  86. int start_sound(SOUND *sound, int index, unsigned char volume, int loop);
  87.   /* Starts playing a sound                                                 */
  88.   /*  Parameters:                                                           */
  89.   /*   sound     Pointer to sound data structure                            */
  90.   /*   index     A number to keep track of the sound with (Used to stop it) */
  91.   /*   loop      Indicates whether sound should be continuously looped      */
  92.   /*  Returns:                                                              */
  93.   /*   TRUE      Sound started successfully                                 */
  94.   /*   FALSE     Sound not started (no free channels)                       */
  95.  
  96. void stop_sound(int index);
  97.   /* Stops playing a sound                                                  */
  98.   /*  Parameters:                                                           */
  99.   /*   index     Index of sound to stop (All with given index are stopped)  */
  100.  
  101. int  sound_playing(int index);
  102.   /* Checks if a sound is still playing                                     */
  103.   /*  Parameters:                                                           */
  104.   /*   index     Index used when the sound was started                      */
  105.   /*  Returns:                                                              */
  106.   /*   TRUE      At least one sound with the specified index is playing     */
  107.   /*   FALSE     No sounds with the specified index are playing             */
  108.  
  109. void set_sound_volume(unsigned char new_volume);
  110.   /* Sets overall sound volume                                              */
  111.   /*  Parameters:                                                           */
  112.   /*   new_volume  New overall sound volume (0-255)                         */
  113.  
  114. extern volatile long intcount;         /* Current count of sound interrupts */
  115. extern volatile int  voicecount;       /* Number of voices currently in use */
  116.  
  117. extern short dspversion;
  118. extern int   autoinit;
  119. extern int   sixteenbit;
  120.  
  121. /* ████████████████████████████████████████████████████████████████████████ */
  122.  
  123.